/*
8 6 7 2
1+2=8
2+3=6
3+4=7
4+5=8

1+4=9
1+4+2(2+3)=21
*/
#include <cstdio>
#include <set>
using namespace std;
#define DEBUG
inline int read()
{
    int c=getchar(), f=1, x=0;
    if(c=='-') f*=-1, x=getchar();
    while(c<'0'&&'9'<c) c=getchar();
    while('0'<=c&&c<='9') 
        x=(x<<3)+(x<<1)+c-'0', c=getchar();
    return f*x;
}
inline void write(long long x)
{
    if(x>=10) write(x/10);
    putchar(x%10+'0');
}

bool two[10];
bool five[10];
set<int> ans;

int get(int x);

void init()
{
    int t=2, f=5;
    while(max(t, f)<1e9){
        int x=get(t), y=get(f);
        ans.insert(x*y);
        if(x*y==90) printf("%d %d\n", t, f);
        t*=2; f*=5;
    }
}

int get(int x)
{
    while(x>=10) x/=10;
    return x;
}

void solve()
{
    init();
    int ret=0;
    for(auto x:ans)
        ret+=x;
    printf("%d\n", ret);   

}

signed main()
{

    #ifdef DEBUG
        freopen("../in.txt", "r", stdin);
        freopen("../out.txt", "w", stdout);
    #endif
    int T=1; //cin >> T; 
    while(T--) 
    {
        solve();
    }
    return 0;
}